package v1

import (
	"ginblog/api/common"
	"ginblog/model"
	"ginblog/utils/errmsg"
	"github.com/gin-gonic/gin"
	"github.com/gin-gonic/gin/binding"
)

// SetUp /设置内容
func SetUp(c *gin.Context) {
	setup := model.Setup{}
	_ = c.ShouldBindBodyWith(&setup, binding.JSON)

	data := setup.SetupContent()
	if setup.GetCode() != 0 {
		common.FailJson(c, setup.GetCode())
		return
	}
	common.SuccessJson(c, errmsg.SUCCESS, data)
}

// EditSetup /编辑文章分类
func EditSetup(c *gin.Context) {
	setup := model.Setup{}
	_ = c.ShouldBindBodyWith(&setup, binding.JSON)
	if !setup.EditSetup() {
		common.FailJson(c, errmsg.ARTICLE_EDIT_FAIL)
		return
	}
	common.SuccessJson(c, errmsg.SUCCESS, []interface{}{})
}
